import { Component, OnInit, ViewChild, OnDestroy, AfterContentInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { NzMessageService, UploadFile, NzModalService, NzNotificationService } from 'ng-zorro-antd';
import { catchError } from 'rxjs/operators';
import { of } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import { SettingsService, TitleService } from '@delon/theme';
import { Constant, ServiceResult } from '@core/constant';
import { ProductService } from '../../../../service/prod/product.service';
import { EmitterService } from 'app/service/emit.service';
import { CommService } from '../../../../service/comm/comm.service';
import { SimpleTableColumn, SimpleTableComponent } from "@delon/abc";
import { fkService } from "../../../../service/fk/fk.service";
import { plService } from "../../../../service/pl/pl.service";

@Component({
  selector: 'product-view-fk2',
  templateUrl: './product-fk2.component.html',
  styleUrls: ['./product-fk2.component.less']
})
export class Productfk2Component implements OnInit, OnDestroy {
  product: any = {
    id: null,
    bmDate: null,
    bmTime: null,
    bxRq: null,
    carColor: null,
    carDetail: null,
    carVin: null,
    conJson: null,
    conNo: null,
    conType: null,
    conUrl: null,
    createSysorg: null,
    createUser: null,
    cusAge: null,
    cusBirthday: null,
    cusDeu: null,
    cusEthnical: null,
    cusGender: null,
    cusIdValidfrom: null,
    cusIdValidto: null,
    cusIncard: null,
    cusMaritalStatus: null,
    cusMobile: null,
    cusName: null,
    cusQqid: null,
    cusRemark: null,
    cusResAddr: null,
    cusWechatid: null,
    cusrIdtype: null,
    danganNo: null,
    diyaStatus: null,
    diyaUser: null,
    fangkBank: null,
    fangkId: null,
    fangkName: null,
    fangkType: null,
    fkAmount: null,
    gpsInsAddr: null,
    gpsInsData: null,
    gpsInsMobile: null,
    gpsInsUser: null,
    gpsStatus: null,
    gpsUser: null,
    guohuStatus: null,
    guohuUser: null,
    luqiaoRq: null,
    lxMobile1: null,
    lxMobile2: null,
    lxMobile3: null,
    lxName1: null,
    lxName2: null,
    lxName3: null,
    mpName: null,
    mpUrl: null,
    mpbackUrl: null,
    nianjiaRq: null,
    orderAmount: null,
    orderArea: null,
    orderBy1: null,
    orderBy10: null,
    orderBy11: null,
    orderBy12: null,
    orderBy13: null,
    orderBy14: null,
    orderBy15: null,
    orderBy16: null,
    orderBy17: null,
    orderBy18: null,
    orderBy2: null,
    orderBy3: null,
    orderBy4: null,
    orderBy5: null,
    orderBy6: null,
    orderBy7: null,
    orderBy8: null,
    orderBy9: null,
    orderCarno: null,
    orderCartype: null,
    orderInfo: null,
    orderNo: null,
    orderOper: null,
    orderPeriod: null,
    orderStatus: null,
    proClass: null,
    proIsdb: null,
    proName: null,
    proNo: null,
    proType: null,
    proWf: null,
    qiandanUser: null,
    sfAnpaijiafang: null,
    sfDianshen: null,
    wbName: null,
    wbUrl: null,
    wbbackUrl: null,
    yinhangUser: null,
    dypname: null,
    dypvalue: null,
    dypyear: null,
    dyptype: null,
    dypclass: null,

    dypremark1: null,
    dypremark2: null,
    dypremark3: null,
    emergencyRelation: null,
    emergencyContact: null,
    emergencyMobile: null,
    emergencyOffice: null,
    emergencyResAddr: null,
    spcomment: '同意',
  };

  productfk: any = {
    bpmStatus: null,
    bxFy: null,
    bxRq: null,
    // carChengshu: 0.8,
    carPinggujia: null,
    carRongzie: null,
    conJine: null,
    createBy: null,
    createDate: null,
    createName: null,
    cusId: null,
    cusMobile: null,
    cusName: null,
    daoshouJine: null,
    fkBy1: null,
    fkBy10: null,
    fkBy11: null,
    fkBy12: null,
    fkBy13: null,
    fkBy2: null,
    fkBy3: null,
    fkBy4: null,
    fkBy5: null,
    fkBy6: null,
    fkBy7: null,
    fkBy8: null,
    fkBy9: null,
    // gpsFy: null,
    id: null,
    // liulFy: null,
    loanAmount: null,
    loanAtta: null,
    loanDate: null,
    loanDbmonth: null,
    loanMonth: null,
    loanMonthSum: null,
    // loanPeriod: 36,
    loanReMethod: null,
    loanRemark: null,
    loanSbamount: null,
    loanSum: null,
    luqiaoRq: null,
    lydbFuwfei: null,
    nianjianRq: null,
    orderNo: null,
    qitaFy: null,
    sysCompanyCode: null,
    sysOrgCode: null,
    updateBy: null,
    updateDate: null,
    updateName: null,
    ygJine: null,

  };
  ps = 100;
  // 搜索表单
  q: any = {
    bpmStatus: "",
    cusName: '',
    cusMobile: '',
    cusIncard: '',
    proNo: '',
    orderNo: ''
  };

  loanReMethods = [{ text: '等额本息', value: '30' }];
  // loanReMethods =  [{text: '等本等息', value: '10'}];

  columns: SimpleTableColumn[] = [
    // { title: '', index: 'key', type: 'checkbox' },
    { title: '操作状态', index: 'bpmStatus' },
    { title: '订单编号', index: 'orderNo' },
    { title: '操作人 ', index: 'logUser' },
    { title: '日志日期 ', index: 'logDate' },
    { title: '日志内容', index: 'logContent' }

  ];
  // 预览图片对象
  previewImage = '';
  previewImage1 = '';
  previewImage2 = '';
  previewImage3 = '';
  previewImage4 = '';
  previewImage5 = '';
  previewImage6 = '';
  previewImage7 = '';
  previewImage8 = '';
  previewImage9 = '';
  previewImage10 = '';
  previewImage11 = '';
  previewImage12 = '';
  previewImage13 = '';
  previewImage14 = '';
  previewImage15 = '';
  previewImage16 = '';
  previewImage17 = '';
  previewImage18 = '';
  previewImage19 = '';
  previewImage20 = '';

  // 是否可以预览
  previewVisible = false;
  previewVisible1 = false;
  previewVisible2 = false;
  previewVisible3 = false;
  previewVisible4 = false;
  previewVisible5 = false;
  previewVisible6 = false;
  previewVisible7 = false;
  previewVisible8 = false;
  previewVisible9 = false;
  previewVisible10 = false;
  previewVisible11 = false;
  previewVisible12 = false;
  previewVisible13 = false;
  previewVisible14 = false;
  previewVisible15 = false;
  previewVisible16 = false;
  previewVisible17 = false;
  previewVisible18 = false;
  previewVisible19 = false;
  previewVisible20 = false;

  // 预览图片地址
  propName = "";
  picUrl = '';
  // 图片上传地址

  proNos = [];
  cusrIdtypes = [];
  cusGenders = [];
  cusMaritalStatuss = [];
  cusDeus = [];
  cusEthnicals = [];
  bpmStatus = [];
  dyptypes = [];
  dypclasss = [];
  relTypes = [];
  avatarUrl: string;
  avatarUrl1: string;
  avatarUrl2: string;
  avatarUrl3: string;
  avatarUrl4: string;
  avatarUrl5: string;
  avatarUrl6: string;

  logurl: string;

  loading = false;
  uploadUrl = '';
  uploadUr1 = '';
  uploadUr2 = '';
  uploadUr3 = '';
  uploadUr4 = '';
  uploadUr5 = '';
  uploadUr6 = '';
  uploadUr7 = '';
  uploadUr8 = '';
  uploadUr9 = '';
  uploadUr10 = '';
  uploadUr11 = '';
  uploadUr12 = '';
  uploadUr13 = '';
  uploadUr14 = '';
  uploadUr15 = '';
  uploadUr16 = '';
  uploadUr17 = '';
  uploadUr18 = '';
  uploadUr19 = '';
  uploadUr20 = '';
  uploadUr21 = '';
  uploadUr22 = '';

  orbitUrl = '';
  avatarParam1 = { sbtype: '1', filetype: 'sb', orderNo: '1' };
  avatarParam2 = { sbtype: '2', filetype: 'sb', orderNo: '2' };
  avatarParam3 = { sbtype: '3', filetype: 'sb', orderNo: '3' };
  avatarParam4 = { sbtype: '4', filetype: 'sb', orderNo: '4' };
  avatarParam5 = { sbtype: '5', filetype: 'jj', orderNo: '5' };
  avatarParam6 = { sbtype: '6', filetype: 'jj', orderNo: '6' };
  avatarParam7 = { sbtype: '7', filetype: 'jj', orderNo: '7' };
  avatarParam8 = { sbtype: '8', filetype: 'jj', orderNo: '8' };
  avatarParam9 = { sbtype: '9', filetype: 'jj', orderNo: '9' };
  avatarParam10 = { sbtype: '10', filetype: 'jj', orderNo: '10' };
  avatarParam11 = { sbtype: '11', filetype: 'jj', orderNo: '11' };
  avatarParam12 = { sbtype: '12', filetype: 'jj', orderNo: '12' };
  avatarParam13 = { sbtype: '13', filetype: 'jj', orderNo: '13' };
  avatarParam14 = { sbtype: '14', filetype: 'jj', orderNo: '14' };
  avatarParam15 = { sbtype: '15', filetype: 'jj', orderNo: '15' };
  avatarParam16 = { sbtype: '16', filetype: 'jj', orderNo: '16' };
  avatarParam17 = { sbtype: '17', filetype: 'jj', orderNo: '17' };
  avatarParam18 = { sbtype: '18', filetype: 'jj', orderNo: '18' };
  avatarParam19 = { sbtype: '19', filetype: 'jj', orderNo: '19' };
  avatarParam20 = { sbtype: '20', filetype: 'jj', orderNo: '20' };
  avatarParam21 = { sbtype: '21', filetype: 'jj', orderNo: '21' };
  avatarParam22 = { sbtype: '22', filetype: 'jj', orderNo: '22' };

  fileList = [];
  fileList1 = [];
  fileList2 = [];
  fileList3 = [];
  fileList4 = [];
  fileList5 = [];
  fileList6 = [];
  fileList7 = [];
  fileList8 = [];
  fileList9 = [];
  fileList10 = [];
  fileList11 = [];
  fileList12 = [];
  fileList13 = [];
  fileList14 = [];
  fileList15 = [];
  fileList16 = [];
  fileList17 = [];
  fileList18 = [];
  fileList19 = [];
  fileList20 = [];
  downurl='';

  backUrl = '';
  MAX_COUNT = 60;
  tabIndex = 0;
  saleing = false;
  private sub: any;
  // 表格组件
  @ViewChild('st') st: SimpleTableComponent;
  // 表格数据url
  urlreplan = this.plService.listorder("11");


  columnsreplan: SimpleTableColumn[] = [
    { title: '', index: 'key', type: 'checkbox' },
    // { title: '产品种类', index: 'proClass' },
    // { title: '融租类型', index: 'proType'},
    // { title: '车辆信息', index: 'orderInfo' },
    // { title: '订单编号 ', index: 'orderNo' },
    // { title: '客户姓名', index: 'cusName' },
    { title: '当前租期', index: 'refPeriod' },
    { title: '总租期', index: 'refTotalPeriod' },
    { title: '还租日期', index: 'refDate' },
    // { title: '期初租金', index: 'refFbenjin' },
    { title: '每月租金', index: 'refAmount' },
    // { title: '归还利息', index: 'refLixi' },
    { title: '剩余租金', index: 'refSybenjin' },
    { title: '备注', index: 'reMark' },
    // { title: '年份', index: 'year' },
    // { title: '广告款', index: 'isAd', render: 'isAd' },
    // { title: '状态', index: 'bpmStatus', render: 'bpmStatus' },

  ];
  // columnsreplan: SimpleTableColumn[] = [
  //   { title: '', index: 'key', type: 'checkbox' },
  //   // { title: '产品种类', index: 'proClass' },
  //   // { title: '融租类型', index: 'proType'},
  //   // { title: '车辆信息', index: 'orderInfo' },
  //   { title: '订单编号 ', index: 'orderNo' },
  //   { title: '客户姓名', index: 'cusName' },
  //   { title: '当前租期', index: 'refPeriod' },
  //   { title: '总租期', index: 'refTotalPeriod' },
  //   { title: '还租日期', index: 'refDate' },
  //   // { title: '期初租金', index: 'refFbenjin' },
  //   { title: '每月租金', index: 'refAmount' },
  //   // { title: '归还利息', index: 'refLixi' },
  //   { title: '剩余租金', index: 'refSybenjin' },
  //   { title: '备注', index: 'reMark' },
  //   // { title: '年份', index: 'year' },
  //   // { title: '广告款', index: 'isAd', render: 'isAd' },
  //   { title: '状态', index: 'bpmStatus', render: 'bpmStatus' },

  // ];

  constructor(
    public setting: SettingsService,
    private fkService: fkService,
    private plService: plService,
    private msg: NzMessageService,
    private modalService: NzModalService,
    private productService: ProductService,
    private emit: EmitterService,
    private notification: NzNotificationService,
    private route: ActivatedRoute,
    private titleService: TitleService,
    private cnt: Constant,
    private router: Router,
    private comm: CommService,
    private confirmServ: NzModalService,
    private notice: NzNotificationService,

  ) { }

  ngOnInit(): void {
    this.loadproNos();
    this.loadcusrIdtypes();
    this.loadcusGenders();
    this.loadcusMaritalStatuss();
    this.loadcusDeus();
    this.loadcusEthnicals();
    this.loadbpmStatus();
    this.loaddyptypes();
    this.loaddypclasss();
    this.loadrelTypes();
    this.uploadUrl = this.productService.uploadsbUrl();
    this.uploadUr1 = this.productService.uploadUrl();
    this.uploadUr2 = this.productService.uploadUrl();
    this.uploadUr3 = this.productService.uploadUrl();
    this.uploadUr4 = this.productService.uploadUrl();
    this.uploadUr5 = this.productService.uploadUrl();
    this.uploadUr6 = this.productService.uploadUrl();
    this.uploadUr7 = this.productService.uploadUrl();
    this.uploadUr8 = this.productService.uploadUrl();
    this.uploadUr9 = this.productService.uploadUrl();
    this.uploadUr10 = this.productService.uploadUrl();
    this.uploadUr11 = this.productService.uploadUrl();
    this.uploadUr12 = this.productService.uploadUrl();
    this.uploadUr13 = this.productService.uploadUrl();
    this.uploadUr14 = this.productService.uploadUrl();
    this.uploadUr15 = this.productService.uploadUrl();
    this.uploadUr16 = this.productService.uploadUrl();
    this.uploadUr17 = this.productService.uploadUrl();
    this.uploadUr18 = this.productService.uploadUrl();
    this.uploadUr19 = this.productService.uploadUrl();
    this.uploadUr20 = this.productService.uploadUrl();
    this.orbitUrl = "http://120.78.150.43/spmq";
    this.uploadreplanExcelUrl = this.plService.uploadreplaninfo();

    // 获取参数
    this.sub = this.route.params.subscribe(params => {
      this.product.id = params["id"];
      // 获取商品详情
      this.getProductInfo();
    });
    // 隐藏reusetab
    setTimeout(() => {
      this.emit.sendMessage("HIDE_REUSE_TAB");
    }, 100);

  }

  // 显示reusetab
  ngOnDestroy() {
    this.emit.sendMessage("SHOW_REUSE_TAB");
  }

  changeTab(index) {
    // 使用异步的方式更新组件, 防止ngIf错误
    Promise.resolve(null).then(() => this.tabIndex = index);
  }
  loadrelTypes() {
    this.relTypes = [];
    this.comm.getType("reltype").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.relTypes.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }
  // 加载产品
  loadproNos() {
    this.proNos = [];
    this.comm.getType("proNo").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.proNos.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }

  // 加载证件类型
  loadcusrIdtypes() {
    this.cusrIdtypes = [];
    this.comm.getType("idType").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.cusrIdtypes.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }

  // 加载性别
  loadcusGenders() {
    this.cusGenders = [];
    this.comm.getType("sex").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.cusGenders.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }

  // 加载婚姻
  loadcusMaritalStatuss() {
    this.cusMaritalStatuss = [];
    this.comm.getType("marType").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.cusMaritalStatuss.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }

  // 加载学历
  loadcusDeus() {
    this.cusDeus = [];
    this.comm.getType("eduType").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.cusDeus.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }
  //加载民族
  loadcusEthnicals() {
    this.cusEthnicals = [];
    this.comm.getType("ethType").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.cusEthnicals.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }
  // 加载证件类型
  loadbpmStatus() {
    this.bpmStatus = [];
    this.comm.getType("bpm_status").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.bpmStatus.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }
  // 加载证件类型
  loaddyptypes() {
    this.dyptypes = [];
    this.comm.getType("dyptype").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.dyptypes.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }
  loaddypclasss() {
    this.dypclasss = [];
    this.comm.getType("dypclass").subscribe(data => {
      const ret: ServiceResult = <ServiceResult>data;
      if (ret.ok) {
        for (const row of ret['data']) {
          this.dypclasss.push({ text: row.typename, value: row.typecode });
        }
      }
    })
  }

  getProductInfofk() {
    this.fkService.getProduct(this.product.orderNo).pipe(
      catchError(err => {
        return of(err);
      })
    ).subscribe(data => {
      if (data.ok === true) {
        this.productfk = data.data;
        // this.productfk.carChengshu = 0.8;
        this.productfk.loanPeriod = this.product.orderPeriod;
        this.productfk.cusMobile = this.product.cusMobile;
        // this.productfk.gpsFy = this.product.orderBy15;
        // this.productfk.carPinggujia = this.product.orderAmount;
        console.log(data.data)
        // this.fyccount();
      }

    })
  }

  getProductInfo() {
    this.productService.getProduct(this.product.id).pipe(
      catchError(err => {
        return of(err);
      })
    ).subscribe(data => {
      console.log("*************************" + JSON.stringify(data.data));
      this.product = data.data;
      this.productfk.orderNo = this.product.orderNo;
      this.productfk.cusName = this.product.cusName;

      this.productfk.cusMobile = this.product.cusMobile;
      this.urlreplan = this.plService.listorder(this.product.orderNo);
      this.backUrl = data.data.wbbackUrl;
      this.getProductInfofk();
      this.titleService.setTitle("编辑订单(" + this.product.orderNo + ")");
      this.logurl = this.productService.logurl() + this.product.orderNo;

      this.avatarParam1 = { sbtype: '10', filetype: '10', orderNo: this.product.orderNo };
      this.avatarParam2 = { sbtype: '3', filetype: '20', orderNo: this.product.orderNo };
      this.avatarParam3 = { sbtype: '6', filetype: '30', orderNo: this.product.orderNo };
      this.avatarParam4 = { sbtype: '2', filetype: '40', orderNo: this.product.orderNo };
      this.avatarParam5 = { sbtype: 'No', filetype: '50', orderNo: this.product.orderNo };
      this.avatarParam6 = { sbtype: '10', filetype: '60', orderNo: this.product.orderNo };
      this.avatarParam7 = { sbtype: '20', filetype: '70', orderNo: this.product.orderNo };
      this.avatarParam8 = { sbtype: '30', filetype: '80', orderNo: this.product.orderNo };
      this.avatarParam9 = { sbtype: '30', filetype: '90', orderNo: this.product.orderNo };
      this.avatarParam10 = { sbtype: '30', filetype: '100', orderNo: this.product.orderNo };
      this.avatarParam11 = { sbtype: '30', filetype: '110', orderNo: this.product.orderNo };
      this.avatarParam12 = { sbtype: '30', filetype: '120', orderNo: this.product.orderNo };
      this.avatarParam13 = { sbtype: '30', filetype: '130', orderNo: this.product.orderNo };
      this.avatarParam14 = { sbtype: '30', filetype: '140', orderNo: this.product.orderNo };
      this.avatarParam15 = { sbtype: '30', filetype: '150', orderNo: this.product.orderNo };
      this.avatarParam16 = { sbtype: '30', filetype: '160', orderNo: this.product.orderNo };
      this.avatarParam17 = { sbtype: '30', filetype: '170', orderNo: this.product.orderNo };
      this.avatarParam18 = { sbtype: '30', filetype: '180', orderNo: this.product.orderNo };
      this.avatarParam19 = { sbtype: '30', filetype: '190', orderNo: this.product.orderNo };
      this.avatarParam20 = { sbtype: '30', filetype: '200', orderNo: this.product.orderNo };
      this.avatarParam21 = { sbtype: '30', filetype: '210', orderNo: this.product.orderNo };
      this.avatarParam22 = { sbtype: '30', filetype: '220', orderNo: this.product.orderNo };

      if (data.data.fxjOrderEmerList.length > 0) {
        this.product.emergencyRelation = data.data.fxjOrderEmerList[0].emergencyRelation;
        this.product.emergencyContact = data.data.fxjOrderEmerList[0].emergencyContact;
        this.product.emergencyMobile = data.data.fxjOrderEmerList[0].emergencyMobile;
        this.product.emergencyOffice = data.data.fxjOrderEmerList[0].emergencyOffice;
        this.product.emergencyResAddr = data.data.fxjOrderEmerList[0].emergencyResAddr;
      }
      console.log("data.data.fxjOrderEmerList[0].emergencyRelation" + data.data.fxjOrderEmerList[0].emergencyRelation);
      if (data.data.fxjOrderLoanList.length > 0) {
        let flag = 0;
        for (const detail of data.data.fxjOrderLoanList) {
          console.log("detail" + detail);

          if (detail.elementNo == '10') {
            this.product.dypname = detail.elementContent;
          }
          if (detail.elementNo == '20') {
            this.product.dypvalue = detail.elementContent;

          }
          if (detail.elementNo == '30') {
            this.product.dypyear = detail.elementContent;

          }
          if (detail.elementNo == '40') {
            this.product.dyptype = detail.elementContent;

          } if (detail.elementNo == '50') {
            this.product.dypclass = detail.elementContent;

          }
          if (detail.elementNo == '60') {
            this.product.dypremark1 = detail.elementContent;

          } if (detail.elementNo == '70') {
            this.product.dypremark2 = detail.elementContent;

          } if (detail.elementNo == '80') {
            this.product.dypremark3 = detail.elementContent;
          }
        }
      };

      if (data.data.fxjOrderAttaList.length > 0) {
        let flag = 0;
        let flag1 = 0;
        let flag2 = 0;
        let flag3 = 0;
        let flag4 = 0;
        let flag5 = 0;
        let flag6 = 0;
        let flag7 = 0;
        let flag8 = 0;
        let flag9 = 0;
        let flag10 = 0;
        let flag11 = 0;
        let flag12 = 0;
        let flag13 = 0;
        let flag14 = 0;
        let flag15 = 0;
        let flag16 = 0;
        let flag17 = 0;
        let flag18 = 0;
        let flag19 = 0;
        let flag20 = 0;
        console.log(this.product.proNo)
        if(this.product.proNo == '10'){
          for (const detail of data.data.fxjOrderAttaList) {
            // this.fileList.push( {
            //   uid: flag,
            //   name: detail.attaName,
            //   status: 'done',
            //   url: detail.attaUrl
            // } )
            // flag++;
  
            if (detail.attaType == '10') {
              this.fileList1.push({
                uid: flag1,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag1++;
            }
            if (detail.attaType == '20') {
              this.fileList2.push({
                uid: flag2,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag2++;
            }
            if (detail.attaType == '30') {
              this.fileList3.push({
                uid: flag3,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag3++;
            }
            if (detail.attaType == '40') {
              this.fileList4.push({
                uid: flag4,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag4++;
            }
            if (detail.attaType == '50') {
              this.fileList5.push({
                uid: flag5,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag5++;
            }
            if (detail.attaType == '60') {
              this.fileList6.push({
                uid: flag6,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag6++;
            }
            if (detail.attaType == '70') {
              this.fileList7.push({
                uid: flag7,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag7++;
            }
            if (detail.attaType == '80') {
              this.fileList8.push({
                uid: flag8,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag8++;
            }
            if (detail.attaType == '90') {
              this.fileList9.push({
                uid: flag9,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag9++;
            }
            if (detail.attaType == '100') {
              this.fileList10.push({
                uid: flag10,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag10++;
            }
            if (detail.attaType == '110') {
              this.fileList11.push({
                uid: flag11,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag11++;
            }
            if (detail.attaType == '120') {
              this.fileList12.push({
                uid: flag12,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag12++;
            }
            if (detail.attaType == '130') {
              this.fileList13.push({
                uid: flag13,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag13++;
            }
            if (detail.attaType == '140') {
              this.fileList14.push({
                uid: flag14,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag14++;
            }
            if (detail.attaType == '150') {
              this.fileList15.push({
                uid: flag15,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag15++;
            }
            if (detail.attaType == '160') {
              this.fileList16.push({
                uid: flag16,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag16++;
            }
            if (detail.attaType == '170') {
              this.fileList17.push({
                uid: flag17,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag17++;
            }
            if (detail.attaType == '180') {
              this.fileList18.push({
                uid: flag18,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag18++;
            }
            if (detail.attaType == '190') {
              this.fileList19.push({
                uid: flag19,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag19++;
            }
            if (detail.attaType == '200') {
              this.fileList20.push({
                uid: flag20,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag20++;
            }
          }
        }
        if(this.product.proNo == '20'){
          for (const detail of data.data.fxjOrderAttaList) {
            // this.fileList.push( {
            //   uid: flag,
            //   name: detail.attaName,
            //   status: 'done',
            //   url: detail.attaUrl
            // } )
            // flag++;
  
            if (detail.attaType == '210') {
              this.fileList1.push({
                uid: flag1,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag1++;
            }
            if (detail.attaType == '220') {
              this.fileList2.push({
                uid: flag2,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag2++;
            }
            if (detail.attaType == '230') {
              this.fileList3.push({
                uid: flag3,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag3++;
            }
            if (detail.attaType == '240') {
              this.fileList4.push({
                uid: flag4,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag4++;
            }
            if (detail.attaType == '250') {
              this.fileList5.push({
                uid: flag5,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag5++;
            }
            if (detail.attaType == '260') {
              this.fileList6.push({
                uid: flag6,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag6++;
            }
            if (detail.attaType == '270') {
              this.fileList7.push({
                uid: flag7,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag7++;
            }
            if (detail.attaType == '280') {
              this.fileList8.push({
                uid: flag8,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag8++;
            }
            if (detail.attaType == '290') {
              this.fileList9.push({
                uid: flag9,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag9++;
            }
            if (detail.attaType == '2100') {
              this.fileList10.push({
                uid: flag10,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag10++;
            }
            if (detail.attaType == '2110') {
              this.fileList11.push({
                uid: flag11,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag11++;
            }
            if (detail.attaType == '2120') {
              this.fileList12.push({
                uid: flag12,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag12++;
            }
            if (detail.attaType == '2130') {
              this.fileList13.push({
                uid: flag13,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag13++;
            }
            if (detail.attaType == '2140') {
              this.fileList14.push({
                uid: flag14,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag14++;
            }
            if (detail.attaType == '2150') {
              this.fileList15.push({
                uid: flag15,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag15++;
            }
            if (detail.attaType == '2160') {
              this.fileList16.push({
                uid: flag16,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag16++;
            }
            if (detail.attaType == '2170') {
              this.fileList17.push({
                uid: flag17,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag17++;
            }
            if (detail.attaType == '2180') {
              this.fileList18.push({
                uid: flag18,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag18++;
            }
            if (detail.attaType == '2190') {
              this.fileList19.push({
                uid: flag19,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag19++;
            }
            if (detail.attaType == '2200') {
              this.fileList20.push({
                uid: flag20,
                name: detail.attaName,
                status: 'done',
                url: detail.attaUrl
              });
              flag20++;
            }
          }
        }
      };
    })
  }


  beforeUpload = (file: File) => {
    const isJPG = file.type === 'image/jpeg';
    const isPNG = file.type === 'image/png';
    if (!isJPG && !isPNG) {
      this.msg.warning(`不支持的格式: ${file.type}`);
    }
    const isLt2M = file.size / 1024 / 1024 < 10;
    if (!isLt2M) {
      this.msg.warning('图片不能超过2MB!');
    }
    return (isJPG || isPNG) && isLt2M;
  }

  private getBase64(img: File, callback: (img: any) => void) {
    if (img) {
      const reader = new FileReader();
      reader.addEventListener('load', () => callback(reader.result));
      reader.readAsDataURL(img);
    }
  }



  formatterYuan = value => `¥ ${value}`;
  parserYuan = value => value.replace('¥', '');

  formatterDollor = value => `${value}`;
  parserDollor = value => value.replace('$', '');

  back() {
    this.router.navigate([this.backUrl]);
  }


  // fyccount() {
  //   let sum = 0;
  //   sum = Number(sum) + Number(this.productfk.carPinggujia);
  //   let chengshu = Number(this.productfk.carChengshu);
  //   if (this.productfk.carRongzie == '' || this.productfk.carRongzie == null) {
  //     this.productfk.carRongzie = chengshu * sum;
  //   }
  //   if (this.productfk.bxFy == '' || this.productfk.bxFy == null) {
  //     // this.productfk.bxFy = sum*0.05;
  //   }
  //   this.product.orderBy51 == this.productfk.carPinggujia;
  //   this.fybcount();
  //   this.fyzhcbcount();
  // }

  // fybcount() {
  //   let sum = 0;
  //   sum = Number(this.productfk.carRongzie);
  //   let jixjine = Number(sum) + Number(this.productfk.bxFy);

  //   if (this.productfk.loanSum == '' || this.productfk.loanSum == null) {
  //     this.productfk.loanSum = jixjine;
  //   }
  // }

  // fyzhcbcount() {
  //   let lixi = 0;
  //   lixi = Number(lixi) + Number(this.productfk.loanMonth);
  //   let loanPeriod = Number(this.productfk.loanPeriod);
  //   let benjin = Number(this.productfk.loanSum);

  //   this.productfk.conJine = Math.round(benjin * (1 + lixi * loanPeriod / 100));

  //   let jxjine = Number(this.productfk.loanSum);

  //   this.productfk.loanAmount = Math.round(benjin * (1 + lixi * loanPeriod / 100) / 1.1034 / 100) * 100;

  //   // this.productfk.lydbFuwfei =  Math.round(benjin*(1+lixi*loanPeriod/100)/1.1034/100)*100 - jxjine;
  //   // this.productfk.daoshouJine = Math.round(((Number(this.productfk.loanSum) - Number(this.productfk.bxFy) - Number(this.productfk.gpsFy) - Number(this.productfk.conJine) / loanPeriod)) * 10) / 10;
  // }
  savestc(orderOper, title) {
    if (orderOper == 'N') {
      if (this.product.spcomment == '' || this.product.spcomment == null) {
        this.msg.warning("请填写不通过意见");
        return;
      }
    }
    if (orderOper == 'R') {
      if (this.product.spcomment == '' || this.product.spcomment == null) {
        this.msg.warning("请填写拒绝意见");
        return;
      }
    }
    this.confirmServ.confirm({
      nzTitle: '确认放款?',
      nzOnOk: () => {
        this.savest(orderOper);
      },
    });
  }
  savest(orderOper) {
    // 调用接口
    if (orderOper == 'M') {
      if (this.product.spcomment == '' || this.product.spcomment == null) {
        this.product.spcomment = "同意";
      }
      if (this.productfk.loanDate === '' || this.productfk.loanDate === null) {
        this.msg.warning("请选择首次还款日期");
        return;
      }
      if (this.productfk.loanReMethod === '' || this.productfk.loanReMethod === null) {
        this.msg.warning("请选择还款方式");
        return;
      }
      // if (this.productfk.loanAmount === '' || this.productfk.loanAmount === null) {
      //   this.msg.warning("请输入放款金额");
      //   return;
      // }
  
      if (this.productfk.loanMonth === '' || this.productfk.loanMonth === null) {
        this.msg.warning("请输入银行月利息");
        return;
      }
      if (this.productfk.loanSum === '' || this.productfk.loanSum === null) {
        this.msg.warning("请输入计息金额");
        return;
      }
    }
   
    // product.spcomment
    let fxjOrderLogList = [];
    if (this.product.spcomment != '' && this.productfk.loanSum != null) {
      // console.log("this.product.dypname*********"+this.product.dypname);

      let dto = {
        orderNo: this.product.orderNo,
        logUser: this.setting.user.username,
        logContent: this.product.spcomment
      }
      fxjOrderLogList.push(dto);
    }

      console.log(this.setting.user.username)
      console.log(this.product.bpmStatus)
      if(this.product.bpmStatus =='15'){
        let fxjOrderMainPage = {
          updateBy: this.setting.user.username,
          diyaUser: this.setting.user.username,
          id: this.product.id,
          orderNo: this.product.orderNo,
          orderOper: orderOper,
          bmDate: this.product.bmDate,
          bmTime: this.product.bmTime,
          bxRq: this.product.bxRq,
          carColor: this.product.carColor,
          carDetail: this.product.carDetail,
          carVin: this.product.carVin,
          conJson: this.product.conJson,
          conNo: this.product.conNo,
          conType: this.product.conType,
          // conUrl: this.product.conUrl,
          createSysorg: this.product.createSysorg,
          createUser: this.product.createUser,
          cusAge: this.product.cusAge,
          cusBirthday: this.product.cusBirthday,
          cusDeu: this.product.cusDeu,
          cusEthnical: this.product.cusEthnical,
          cusGender: this.product.cusGender,
          cusIdValidfrom: this.product.cusIdValidfrom,
          cusIdValidto: this.product.cusIdValidto,
          cusIncard: this.product.cusIncard,
          cusMaritalStatus: this.product.cusMaritalStatus,
          cusMobile: this.product.cusMobile,
          cusName: this.product.cusName,
          cusQqid: this.product.cusQqid,
          cusRemark: this.product.cusRemark,
          cusResAddr: this.product.cusResAddr,
          cusWechatid: this.product.cusWechatid,
          cusrIdtype: this.product.cusrIdtype,
          danganNo: this.product.danganNo,
          diyaStatus: this.product.diyaStatus,
          fangkBank: this.product.fangkBank,
          fangkId: this.product.fangkId,
          fangkName: this.product.fangkName,
          fangkType: this.product.fangkType,
          fkAmount: this.product.fkAmount,
          gpsInsAddr: this.product.gpsInsAddr,
          gpsInsData: this.product.gpsInsData,
          gpsInsMobile: this.product.gpsInsMobile,
          gpsInsUser: this.product.gpsInsUser,
          gpsStatus: this.product.gpsStatus,
          gpsUser: this.product.gpsUser,
          guohuStatus: this.product.guohuStatus,
          guohuUser: this.product.guohuUser,
          luqiaoRq: this.product.luqiaoRq,
          lxMobile1: this.product.lxMobile1,
          lxMobile2: this.product.lxMobile2,
          lxMobile3: this.product.lxMobile3,
          lxName1: this.product.lxName1,
          lxName2: this.product.lxName2,
          lxName3: this.product.lxName3,
          mpName: this.product.mpName,
          mpUrl: this.product.mpUrl,
          mpbackUrl: this.product.mpbackUrl,
          nianjiaRq: this.product.nianjiaRq,
          orderAmount: this.product.orderAmount,
          orderArea: this.product.orderArea,
          orderBy1: this.product.orderBy1,
          orderBy2: this.product.orderBy2,
          orderBy3: this.product.orderBy3,
          orderBy4: this.product.orderBy4,
          orderBy5: this.product.orderBy5,
          orderBy6: this.product.orderBy6,
          orderBy7: this.product.orderBy7,
          orderBy8: this.product.orderBy8,
          orderBy9: this.product.orderBy9,
          orderBy10: this.product.orderBy10,
          orderBy11: this.product.orderBy11,
          orderBy12: this.product.orderBy12,
          orderBy13: this.product.orderBy13,
          orderBy14: this.product.orderBy14,
          orderBy15: this.product.orderBy15,
          orderBy16: this.product.orderBy16,
          orderBy17: this.product.orderBy17,
          orderBy18: this.product.orderBy18,
          orderBy19: this.product.orderBy19,
          orderBy20: this.product.orderBy20,
          orderBy21: this.product.orderBy21,
          orderBy22: this.product.orderBy22,
          orderBy23: this.product.orderBy23,
          orderBy24: this.product.orderBy24,
          orderBy25: this.product.orderBy25,
          orderBy26: this.product.orderBy26,
          orderBy27: this.product.orderBy27,
          orderBy28: this.product.orderBy28,
          orderBy29: this.product.orderBy29,
          orderBy30: this.product.orderBy30,
          orderBy31: this.product.orderBy31,
          orderBy32: this.product.orderBy32,
          orderBy33: this.product.orderBy33,
          orderBy34: this.product.orderBy34,
          orderBy35: this.product.orderBy35,
          orderBy36: this.product.orderBy36,
          orderBy37: this.product.orderBy37,
          orderBy38: this.product.orderBy38,
          orderBy39: this.product.orderBy39,
          orderBy40: this.product.orderBy40,
          orderBy41: this.product.orderBy41,
          orderBy42: this.product.orderBy42,
          orderBy43: this.product.orderBy43,
          orderBy44: this.product.orderBy44,
          orderBy45: this.product.orderBy45,
          orderBy46: this.product.orderBy46,
          orderBy47: this.product.orderBy47,
          orderBy48: this.product.orderBy48,
          orderBy49: this.product.orderBy49,
          orderBy50: this.product.orderBy50,
          orderBy51: this.product.orderBy51,
          orderBy52: this.product.orderBy52,
          orderBy53: this.product.orderBy53,
          orderBy54: this.product.orderBy54,
          orderBy55: this.product.orderBy55,
          orderBy56: this.product.orderBy56,
          orderBy57: this.product.orderBy57,
          orderBy58: this.product.orderBy58,
          orderBy59: this.product.orderBy59,
          orderBy60: this.product.orderBy60,
          orderBy61: this.product.orderBy61,
          orderBy62: this.product.orderBy62,
          orderBy63: this.product.orderBy63,
          orderBy64: this.product.orderBy64,
          orderBy65: this.product.orderBy65,
          orderBy66: this.product.orderBy66,
          orderBy67: this.product.orderBy67,
          orderBy68: this.product.orderBy68,
          orderBy69: this.product.orderBy69,
          orderBy70: this.product.orderBy70,
          orderBy71: this.product.orderBy71,
          orderBy72: this.product.orderBy72,
          orderBy73: this.product.orderBy73,
          orderBy74: this.product.orderBy74,
          orderBy75: this.product.orderBy75,
          orderBy76: this.product.orderBy76,
          orderBy77: this.product.orderBy77,
          orderBy78: this.product.orderBy78,
          orderBy79: this.product.orderBy79,
          orderBy80: this.product.orderBy80,
          orderBy81: this.product.orderBy81,
          orderBy82: this.product.orderBy82,
          orderBy83: this.product.orderBy83,
          orderBy84: this.product.orderBy84,
          orderBy85: this.product.orderBy85,
          orderBy86: this.product.orderBy86,
          orderBy87: this.product.orderBy87,
          orderBy88: this.product.orderBy88,
          orderBy89: this.product.orderBy89,
          orderBy90: this.product.orderBy90,
          orderBy91: this.product.orderBy91,
          orderBy92: this.product.orderBy92,
          orderBy93: this.product.orderBy93,
          orderBy94: this.product.orderBy94,
          orderBy95: this.product.orderBy95,
          orderBy96: this.product.orderBy96,
          orderBy97: this.product.orderBy97,
          orderBy98: this.product.orderBy98,
          orderBy99: this.product.orderBy99,
          orderBy100: this.product.orderBy100,
          orderCarno: this.product.orderCarno,
          orderCartype: this.product.orderCartype,
          orderInfo: this.product.orderInfo,
    
          orderPeriod: this.product.orderPeriod,
          orderStatus: this.product.orderStatus,
          proClass: this.product.proClass,
          proIsdb: this.product.proIsdb,
          proName: this.product.proName,
          proNo: this.product.proNo,
          proType: this.product.proType,
          proWf: this.product.proWf,
          qiandanUser: this.product.qiandanUser,
          sfAnpaijiafang: this.product.sfAnpaijiafang,
          sfDianshen: this.product.sfDianshen,
          wbName: this.product.wbName,
          wbUrl: this.product.wbUrl,
          wbbackUrl: this.product.wbbackUrl,
          yinhangUser: this.product.yinhangUser,
          fxjOrderLogList: JSON.parse(JSON.stringify(fxjOrderLogList))
    
        };
        this.productService.editPro(fxjOrderMainPage).pipe(
          catchError(err => {
            return of(err);
          })
        ).subscribe(data => {
          console.log("data.ok" + data.ok);
          if (data.ok === true) {
            if (orderOper != "M") {
              this.back();
            } 
            // else {
            //   this.st.reload();
            // }
            this.msg.success('保存成功');
            this.emit.sendMessage("RELOAD_GOODS_LIST");
          } else {
            this.msg.error(data.respMsg);
          }
        })
      }else{
        let fxjOrderMainPage = {
          updateBy: this.setting.user.username,
          id: this.product.id,
          orderNo: this.product.orderNo,
          orderOper: orderOper,
          bmDate: this.product.bmDate,
          bmTime: this.product.bmTime,
          bxRq: this.product.bxRq,
          carColor: this.product.carColor,
          carDetail: this.product.carDetail,
          carVin: this.product.carVin,
          conJson: this.product.conJson,
          conNo: this.product.conNo,
          conType: this.product.conType,
          conUrl: this.product.conUrl,
          createSysorg: this.product.createSysorg,
          createUser: this.product.createUser,
          cusAge: this.product.cusAge,
          cusBirthday: this.product.cusBirthday,
          cusDeu: this.product.cusDeu,
          cusEthnical: this.product.cusEthnical,
          cusGender: this.product.cusGender,
          cusIdValidfrom: this.product.cusIdValidfrom,
          cusIdValidto: this.product.cusIdValidto,
          cusIncard: this.product.cusIncard,
          cusMaritalStatus: this.product.cusMaritalStatus,
          cusMobile: this.product.cusMobile,
          cusName: this.product.cusName,
          cusQqid: this.product.cusQqid,
          cusRemark: this.product.cusRemark,
          cusResAddr: this.product.cusResAddr,
          cusWechatid: this.product.cusWechatid,
          cusrIdtype: this.product.cusrIdtype,
          danganNo: this.product.danganNo,
          diyaStatus: this.product.diyaStatus,
          diyaUser: this.product.diyaUser,
          fangkBank: this.product.fangkBank,
          fangkId: this.product.fangkId,
          fangkName: this.product.fangkName,
          fangkType: this.product.fangkType,
          fkAmount: this.product.fkAmount,
          gpsInsAddr: this.product.gpsInsAddr,
          gpsInsData: this.product.gpsInsData,
          gpsInsMobile: this.product.gpsInsMobile,
          gpsInsUser: this.product.gpsInsUser,
          gpsStatus: this.product.gpsStatus,
          gpsUser: this.product.gpsUser,
          guohuStatus: this.product.guohuStatus,
          guohuUser: this.product.guohuUser,
          luqiaoRq: this.product.luqiaoRq,
          lxMobile1: this.product.lxMobile1,
          lxMobile2: this.product.lxMobile2,
          lxMobile3: this.product.lxMobile3,
          lxName1: this.product.lxName1,
          lxName2: this.product.lxName2,
          lxName3: this.product.lxName3,
          mpName: this.product.mpName,
          mpUrl: this.product.mpUrl,
          mpbackUrl: this.product.mpbackUrl,
          nianjiaRq: this.product.nianjiaRq,
          orderAmount: this.product.orderAmount,
          orderArea: this.product.orderArea,
          orderBy1: this.product.orderBy1,
          orderBy2: this.product.orderBy2,
          orderBy3: this.product.orderBy3,
          orderBy4: this.product.orderBy4,
          orderBy5: this.product.orderBy5,
          orderBy6: this.product.orderBy6,
          orderBy7: this.product.orderBy7,
          orderBy8: this.product.orderBy8,
          orderBy9: this.product.orderBy9,
          orderBy10: this.product.orderBy10,
          orderBy11: this.product.orderBy11,
          orderBy12: this.product.orderBy12,
          orderBy13: this.product.orderBy13,
          orderBy14: this.product.orderBy14,
          orderBy15: this.product.orderBy15,
          orderBy16: this.product.orderBy16,
          orderBy17: this.product.orderBy17,
          orderBy18: this.product.orderBy18,
          orderBy19: this.product.orderBy19,
          orderBy20: this.product.orderBy20,
          orderBy21: this.product.orderBy21,
          orderBy22: this.product.orderBy22,
          orderBy23: this.product.orderBy23,
          orderBy24: this.product.orderBy24,
          orderBy25: this.product.orderBy25,
          orderBy26: this.product.orderBy26,
          orderBy27: this.product.orderBy27,
          orderBy28: this.product.orderBy28,
          orderBy29: this.product.orderBy29,
          orderBy30: this.product.orderBy30,
          orderBy31: this.product.orderBy31,
          orderBy32: this.product.orderBy32,
          orderBy33: this.product.orderBy33,
          orderBy34: this.product.orderBy34,
          orderBy35: this.product.orderBy35,
          orderBy36: this.product.orderBy36,
          orderBy37: this.product.orderBy37,
          orderBy38: this.product.orderBy38,
          orderBy39: this.product.orderBy39,
          orderBy40: this.product.orderBy40,
          orderBy41: this.product.orderBy41,
          orderBy42: this.product.orderBy42,
          orderBy43: this.product.orderBy43,
          orderBy44: this.product.orderBy44,
          orderBy45: this.product.orderBy45,
          orderBy46: this.product.orderBy46,
          orderBy47: this.product.orderBy47,
          orderBy48: this.product.orderBy48,
          orderBy49: this.product.orderBy49,
          orderBy50: this.product.orderBy50,
          orderBy51: this.product.orderBy51,
          orderBy52: this.product.orderBy52,
          orderBy53: this.product.orderBy53,
          orderBy54: this.product.orderBy54,
          orderBy55: this.product.orderBy55,
          orderBy56: this.product.orderBy56,
          orderBy57: this.product.orderBy57,
          orderBy58: this.product.orderBy58,
          orderBy59: this.product.orderBy59,
          orderBy60: this.product.orderBy60,
          orderBy61: this.product.orderBy61,
          orderBy62: this.product.orderBy62,
          orderBy63: this.product.orderBy63,
          orderBy64: this.product.orderBy64,
          orderBy65: this.product.orderBy65,
          orderBy66: this.product.orderBy66,
          orderBy67: this.product.orderBy67,
          orderBy68: this.product.orderBy68,
          orderBy69: this.product.orderBy69,
          orderBy70: this.product.orderBy70,
          orderBy71: this.product.orderBy71,
          orderBy72: this.product.orderBy72,
          orderBy73: this.product.orderBy73,
          orderBy74: this.product.orderBy74,
          orderBy75: this.product.orderBy75,
          orderBy76: this.product.orderBy76,
          orderBy77: this.product.orderBy77,
          orderBy78: this.product.orderBy78,
          orderBy79: this.product.orderBy79,
          orderBy80: this.product.orderBy80,
          orderBy81: this.product.orderBy81,
          orderBy82: this.product.orderBy82,
          orderBy83: this.product.orderBy83,
          orderBy84: this.product.orderBy84,
          orderBy85: this.product.orderBy85,
          orderBy86: this.product.orderBy86,
          orderBy87: this.product.orderBy87,
          orderBy88: this.product.orderBy88,
          orderBy89: this.product.orderBy89,
          orderBy90: this.product.orderBy90,
          orderBy91: this.product.orderBy91,
          orderBy92: this.product.orderBy92,
          orderBy93: this.product.orderBy93,
          orderBy94: this.product.orderBy94,
          orderBy95: this.product.orderBy95,
          orderBy96: this.product.orderBy96,
          orderBy97: this.product.orderBy97,
          orderBy98: this.product.orderBy98,
          orderBy99: this.product.orderBy99,
          orderBy100: this.product.orderBy100,
          orderCarno: this.product.orderCarno,
          orderCartype: this.product.orderCartype,
          orderInfo: this.product.orderInfo,
          orderPeriod: this.product.orderPeriod,
          orderStatus: this.product.orderStatus,
          proClass: this.product.proClass,
          proIsdb: this.product.proIsdb,
          proName: this.product.proName,
          proNo: this.product.proNo,
          proType: this.product.proType,
          proWf: this.product.proWf,
          qiandanUser: this.product.qiandanUser,
          sfAnpaijiafang: this.product.sfAnpaijiafang,
          sfDianshen: this.product.sfDianshen,
          wbName: this.product.wbName,
          wbUrl: this.product.wbUrl,
          wbbackUrl: this.product.wbbackUrl,
          yinhangUser: this.product.yinhangUser,
          fxjOrderLogList: JSON.parse(JSON.stringify(fxjOrderLogList))
    
        };
        this.productService.editPro(fxjOrderMainPage).pipe(
          catchError(err => {
            return of(err);
          })
        ).subscribe(data => {
          console.log("data.ok" + data.ok);
          if (data.ok === true) {
            if (orderOper != "M") {
              this.back();
            } 
            // else {
            //   this.st.reload();
            // }
            this.msg.success('操作成功');
            this.emit.sendMessage("RELOAD_GOODS_LIST");
          } else {
            this.msg.error(data.respMsg);
          }
        })
      }
   if(orderOper=='Y' || orderOper =='M' || orderOper =='S' ){
    this.savefk();
    console.log('sss')
   }
  }

  savefk() {

    let fxjLoanFk = {
      updateBy: this.setting.user.username,
      id: this.productfk.id,
      bpmStatus: this.productfk.bpmStatus,
      bxFy: this.productfk.bxFy,
      bxRq: this.productfk.bxRq,
      carChengshu: this.productfk.carChengshu,
      carPinggujia: this.productfk.carPinggujia,
      carRongzie: this.productfk.carRongzie,
      conJine: this.productfk.conJine,
      createBy: this.productfk.createBy,
      // createDate: this.productfk.createDate,
      createName: this.productfk.createName,
      cusId: this.productfk.cusId,
      cusMobile: this.productfk.cusMobile,
      cusName: this.productfk.cusName,
      daoshouJine: this.productfk.daoshouJine,
      fkBy1: this.productfk.fkBy1,
      fkBy10: this.productfk.fkBy10,
      fkBy11: this.productfk.fkBy11,
      fkBy12: this.productfk.fkBy12,
      fkBy13: this.productfk.fkBy13,
      fkBy2: this.productfk.fkBy2,
      fkBy3: this.productfk.fkBy3,
      fkBy4: this.productfk.fkBy4,
      fkBy5: this.productfk.fkBy5,
      fkBy6: this.productfk.fkBy6,
      fkBy7: this.productfk.fkBy7,
      fkBy8: this.productfk.fkBy8,
      fkBy9: this.productfk.fkBy9,
      gpsFy: this.productfk.gpsFy,
      liulFy: this.productfk.liulFy,
      loanAmount: this.productfk.loanAmount,
      loanAtta: this.productfk.loanAtta,
      loanDate: this.productfk.loanDate,
      loanDbmonth: this.productfk.loanDbmonth,
      loanMonth: this.productfk.loanMonth,
      loanMonthSum: this.productfk.loanMonthSum,
      loanPeriod: this.productfk.loanPeriod,
      loanReMethod: this.productfk.loanReMethod,
      loanRemark: this.productfk.loanRemark,
      loanSbamount: this.productfk.loanSbamount,
      loanSum: this.productfk.loanSum,
      luqiaoRq: this.productfk.luqiaoRq,
      lydbFuwfei: this.productfk.lydbFuwfei,
      nianjianRq: this.productfk.nianjianRq,
      orderNo: this.productfk.orderNo,
      qitaFy: this.productfk.qitaFy,
      sysCompanyCode: this.productfk.sysCompanyCode,
      sysOrgCode: this.productfk.sysOrgCode,
      // updateDate: this.productfk.updateDate,
      updateName: this.productfk.updateName,
      ygJine: this.productfk.ygJine,
    };

    // 调用接口
    console.log("fxjLoanFk*******" + JSON.stringify(fxjLoanFk));
    this.fkService.editPro(fxjLoanFk).pipe(
      catchError(err => {
        return of(err);
      })
    ).subscribe(data => {
      if (data.ok === true) {
        // this.msg.success('修改成功');
        // this.emit.sendMessage("RELOAD_GOODS_LIST");
      } else {
        this.msg.error(data['message']);
      }
    })
  }

  changeColor(res) {
    this.product.colorSort = res.color.hex;
  }


  packattac() {
    this.confirmServ.confirm({
      nzTitle: '确定打包附件?',
      nzOnOk: () => {
        this.packatta();
        },
    });
  }
  packatta(){
    this.comm.getzip(this.product.orderNo).pipe(
      catchError(err => {
        return of(err);
      })
    ).subscribe(data => {
      this.msg.success('打包成功');

      console.log(JSON.stringify("data"+JSON.stringify(data)));
       this.downurl =   data[0].fileUrl;
    })
  }

  handleChange1(info: { file: UploadFile }) {


    if (info.file.status === 'uploading') {
      this.loading = true;
      return;
    }
    if (info.file.status === 'done') {
      this.getBase64(info.file.originFileObj, (img: any) => {
        this.loading = false;
        this.avatarUrl1 = img;
        console.log("info1*********" + JSON.stringify(info.file.response[0].piccontent));

        var sfxx = JSON.parse(info.file.response[0].piccontent)
        this.product.cusName = sfxx.result.cardsinfo[0].items[1].content;
        this.product.cusGender = sfxx.result.cardsinfo[0].items[2].content;
        this.product.cusEthnical = sfxx.result.cardsinfo[0].items[3].content;
        this.product.cusBirthday = sfxx.result.cardsinfo[0].items[4].content;
        this.product.cusResAddr = sfxx.result.cardsinfo[0].items[5].content;
        this.product.cusIncard = sfxx.result.cardsinfo[0].items[6].content;
        info.file = null;
      });
    }
    if (info.file.status === 'error') {
      this.msg.error(info.file.error.error);
    }
  }
  handleChange2(info: { file: UploadFile }) {
    if (info.file.status === 'uploading') {
      this.loading = true;
      return;
    }


    if (info.file.status === 'done') {
      this.getBase64(info.file.originFileObj, (img: any) => {
        this.loading = false;
        this.avatarUrl2 = img;


        var sfxx = JSON.parse(info.file.response[0].piccontent)

        console.log("varfrom*********" + JSON.stringify(sfxx));
        this.product.cusIdValidfrom = sfxx.result.cardsinfo[0].items[3].content;
        this.product.cusIdValidto = sfxx.result.cardsinfo[0].items[4].content;

      });
    }
    if (info.file.status === 'error') {
      this.msg.error(info.file.error.error);
    }
  }
  handleChange3(info: { file: UploadFile }) {
    if (info.file.status === 'uploading') {
      this.loading = true;
      return;
    }
    if (info.file.status === 'done') {
      this.getBase64(info.file.originFileObj, (img: any) => {
        this.loading = false;
        this.avatarUrl3 = img;

        var sfxx = JSON.parse(info.file.response[0].piccontent)

        this.product.dyptype = sfxx.result.cardsinfo[0].items[5].content + "/" + sfxx.result.cardsinfo[0].items[2].content;

        this.product.dypname = sfxx.result.cardsinfo[0].items[1].content;
        this.product.dypvalue = sfxx.result.cardsinfo[0].items[3].content;
        this.product.dypyear = sfxx.result.cardsinfo[0].items[8].content + "/" + sfxx.result.cardsinfo[0].items[9].content;
        this.product.dypclass = sfxx.result.cardsinfo[0].items[10].content;

        this.product.dypremark1 = sfxx.result.cardsinfo[0].items[4].content;
        this.product.dypremark2 = sfxx.result.cardsinfo[0].items[6].content;
        this.product.dypremark3 = sfxx.result.cardsinfo[0].items[7].content;

      });
    }
    if (info.file.status === 'error') {
      this.msg.error(info.file.error.error);
    }
  }
  handleChange4(info: { file: UploadFile }) {
    if (info.file.status === 'uploading') {
      this.loading = true;
      return;
    }
    if (info.file.status === 'done') {
      this.getBase64(info.file.originFileObj, (img: any) => {
        this.loading = false;
        this.avatarUrl4 = img;
        var sfxx = JSON.parse(info.file.response[0].piccontent)

        console.log("varfrom*********" + JSON.stringify(sfxx));
        this.product.emergencyContact = sfxx.result.cardsinfo[0].items[1].content;

        this.product.emergencyResAddr = sfxx.result.cardsinfo[0].items[5].content;
        this.product.emergencyOffice = sfxx.result.cardsinfo[0].items[6].content;

      });
    }
    if (info.file.status === 'error') {
      this.msg.error(info.file.error.error);
    }
  }
  handleChange5(info: { file: UploadFile }) {
    if (info.file.status === 'uploading') {
      this.loading = true;
      return;
    }
    if (info.file.status === 'done') {
      this.getBase64(info.file.originFileObj, (img: any) => {
        this.loading = false;
        this.avatarUrl5 = img;

      });
    }
    if (info.file.status === 'error') {
      this.msg.error(info.file.error.error);
    }
  }

  handlePreview = (file: UploadFile) => {
    console.log("1")
    // this.previewImage = file.url || file.thumbUrl;
    // this.previewVisible = true;

    // this.previewImage1 = file.url || file.thumbUrl;
    // this.previewVisible1 = true;

    // this.previewImage2 = file.url || file.thumbUrl;
    // this.previewVisible2 = true;

    // this.previewImage3 = file.url || file.thumbUrl;
    // this.previewVisible3 = true;

    // this.previewImage4 = file.url || file.thumbUrl;
    // this.previewVisible4 = true;

    // this.previewImage5 = file.url || file.thumbUrl;
    // this.previewVisible5 = true;
  }
  handlePreview1 = (file: UploadFile) => {
    console.log("1");
    console.log(file)
    this.previewImage1 = file.url || file.thumbUrl;
    this.previewVisible1 = true;
    console.log(this.previewImage1);
  }
  handlePreview2 = (file: UploadFile) => {
    console.log("2");
    console.log(file)
    this.previewImage2 = file.url || file.thumbUrl;
    this.previewVisible2 = true;
    console.log(this.previewImage2);
  }
  handlePreview3 = (file: UploadFile) => {
    console.log("3");
    console.log(file)
    this.previewImage3 = file.url || file.thumbUrl;
    this.previewVisible3 = true;
    console.log(this.previewImage3);
  }
  handlePreview4 = (file: UploadFile) => {
    console.log("4");
    console.log(file)
    this.previewImage4 = file.url || file.thumbUrl;
    this.previewVisible4 = true;
    console.log(this.previewImage4);
  }
  handlePreview5 = (file: UploadFile) => {
    console.log("5");
    console.log(file)
    this.previewImage5 = file.url || file.thumbUrl;
    this.previewVisible5 = true;
    console.log(this.previewImage5);
  }
  handlePreview6 = (file: UploadFile) => {
    console.log(file)
    this.previewImage6 = file.url || file.thumbUrl;
    this.previewVisible6 = true;
  }
  handlePreview7 = (file: UploadFile) => {
    this.previewImage7 = file.url || file.thumbUrl;
    this.previewVisible7 = true;
  }
  handlePreview8 = (file: UploadFile) => {
    this.previewImage8 = file.url || file.thumbUrl;
    this.previewVisible8 = true;
  }
  handlePreview9 = (file: UploadFile) => {
    this.previewImage9 = file.url || file.thumbUrl;
    this.previewVisible9 = true;
  }
  handlePreview10 = (file: UploadFile) => {
    this.previewImage10 = file.url || file.thumbUrl;
    this.previewVisible10 = true;
  }
  handlePreview11 = (file: UploadFile) => {
    this.previewImage11 = file.url || file.thumbUrl;
    this.previewVisible11 = true;
  }
  handlePreview12 = (file: UploadFile) => {
    this.previewImage12 = file.url || file.thumbUrl;
    this.previewVisible12 = true;
  }
  handlePreview13 = (file: UploadFile) => {
    this.previewImage13 = file.url || file.thumbUrl;
    this.previewVisible13 = true;
  }
  handlePreview14 = (file: UploadFile) => {
    this.previewImage14 = file.url || file.thumbUrl;
    this.previewVisible14 = true;
  }
  handlePreview15 = (file: UploadFile) => {
    this.previewImage15 = file.url || file.thumbUrl;
    this.previewVisible15 = true;
  }
  handlePreview16 = (file: UploadFile) => {
    this.previewImage16 = file.url || file.thumbUrl;
    this.previewVisible16 = true;
  }
  handlePreview17 = (file: UploadFile) => {
    this.previewImage17 = file.url || file.thumbUrl;
    this.previewVisible17 = true;
  }
  handlePreview18 = (file: UploadFile) => {
    this.previewImage18 = file.url || file.thumbUrl;
    this.previewVisible18 = true;
  }
  handlePreview19 = (file: UploadFile) => {
    this.previewImage19 = file.url || file.thumbUrl;
    this.previewVisible19 = true;
  }
  handlePreview20 = (file: UploadFile) => {
    this.previewImage20 = file.url || file.thumbUrl;
    this.previewVisible20 = true;
  }
  data = [];
  uploadreplanExcelUrl = '';
  // mbdownurl = 'https://zhaodui.oss-cn-shenzhen.aliyuncs.com/doc/hkjh.xls';
  mbdownurl = 'https://www.sxtcf.com/hkjh.xls';

  uploadProd(info: { file: UploadFile }) {
    if (info.file.status === 'uploading') {
      this.loading = true;
    }
    if (info.file.status === 'done') {
      this.loading = false;
      this.st.load();
      this.notice.create('success', '成功', '还款信息导入成功');
    }
    if (info.file.status === 'error') {
      this.loading = false;
      this.notice.create('error', '失败', '还款信息导入失败');
    }
  }
  refresh() {
    this.st.reload();
  }
    // 图片 wuwq
    upLoadChange(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
        if (event.type == 'success') {
            console.log('ss');
        } else if (event.type == 'removed') {
          console.log('aa');
          let picId = file.id ? file.id : file.response[0].fileId
          this.delPic(picId);
        }
    }
  }
  // 图片 wuwq
  upLoadChange1(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  // 图片 wuwq
  upLoadChange2(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange3(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange4(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  upLoadChange5(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange6(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange7(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  upLoadChange8(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  upLoadChange9(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }


  upLoadChange10(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }


  upLoadChange11(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }


  upLoadChange12(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }


  upLoadChange13(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }


  upLoadChange14(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }


  upLoadChange15(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  upLoadChange16(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  upLoadChange17(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange18(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange19(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }
  upLoadChange20(event) {
    console.log(event);
    let file = event ? event.file : null;
    console.log(file);
    let datas = file && file.id ? file : file.response;
    console.log(datas);
    if (datas) {
      if (event.type == 'success') {
        console.log('ss');
      } else if (event.type == 'removed') {
        console.log('aa');
        let picId = file.id ? file.id : file.response[0].fileId
        this.delPic(picId);
      }
    }
  }

  // 删除图片 wuwq
  delPic(id) {
    this.productService.delfile(id).pipe(
      catchError(err => {
        return of(err);
      })
    ).subscribe(data => {
      if (data.ok) {
        // this.productorder = data.data;
        // console.log(this.productorder);
        // this.reload();
      } else {
        console.log("22")
      }
    })
  }

}
